package com.example.edupublisher.service.imp;

import com.example.edupublisher.bean.*;
import com.example.edupublisher.mapper.TrafficSourceStatsMapper;
import com.example.edupublisher.service.TrafficSourceStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName: TrafficSourceStatsServiceImpl
 * Package: com.atguigu.edu.publisher.service.impl
 * Description:
 *
 * @Author Mr.2
 * @Create 2023/9/11 10:53
 * @Version 1.0
 */
@Service
public class TrafficSourceStatsServiceImpl implements TrafficSourceStatsService {

    // 自动装载 Mapper 接口实现类
    @Autowired
    TrafficSourceStatsMapper trafficSourceStatsMapper;

    // 1. 获取 各来源 独立访客数
    @Override
    public List<TrafficScUvCt> getUvCt(Integer date) {
        return trafficSourceStatsMapper.selectUvCt(date);
    }

    // 2. 获取 各来源 会话数
    @Override
    public List<TrafficScSvCt> getSvCt(Integer date) {
        return trafficSourceStatsMapper.selectSvCt(date);
    }

    // 3. 获取 各来源 会话平均页面浏览数
    @Override
    public List<TrafficScPvPerSession> getPvPerSession(Integer date) {
        return trafficSourceStatsMapper.selectPvPerSession(date);
    }

    // 4. 获取 各来源 会话平均页面访问时长
    @Override
    public List<TrafficScDurPerSession> getDurPerSession(Integer date) {
        return trafficSourceStatsMapper.selectDurPerSession(date);
    }
    // 5. 获取 各来源 跳出率
    @Override
    public List<TrafficScUjRate> getUjRate(Integer date) {
        return trafficSourceStatsMapper.selectUjRate(date);
    }
}
